
<style>
table { 
    width: 100%; 
    
}  
</style>
<form action="/gov/changeGOVstat.php" method="post" >
<script type="text/javascript">  
$(document).ready(function(){
  setTimeout(function () { test(); }, 500);
        function test(){
          $("table").addClass("table-bordered table-hover table-striped");
      }
    });
</script>
<div class="row">
<div class="col-md-2"> 
<div class="btn-group-vertical hidden-xs" style="width: 200px;position:fixed;">
  <button type="submit"  class="btn btn-default" name="stat" value="yes">启动选中主机监控</button>
  <button type="submit"  class="btn btn-default" name="stat" value="no" >关闭选择主机监控</button>
  <button type="button" class="btn btn-default" onclick="$('tr').show()" value="yes">显示所有</button>
  <button type="button" class="btn btn-default" onclick="search(this)" value="yes">显示监控的主机</button>
  <button type="button" class="btn btn-default" onclick="search(this)" value="no">显示不监控的主机</button>
  <button type="button" class="btn btn-default" onclick="search(this)" value="网站打开异常">显示异常的主机</button>
</div>

</div>
 <div class="col-md-10">
<?php
header("Content-type: text/html; charset=utf-8");
$con = mysql_connect("113.215.1.161","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
//code
mysql_select_db("mydb", $con);//选库
mysql_query("set names 'utf8'");
$result = mysql_query("SELECT * FROM govTab ORDER BY mon DESC,stat");
echo '<table id="store" class="table-bordered table-hover table-striped">
<tr>
<th>gov</th>
<th>网站</th>
<th>状态</th>
<th>监控状态</th>
<th>选中</th>
</tr>';
while($row = mysql_fetch_array($result))
  {
    if ($row["mon"]=="no"){
      echo "<tr style='color:grey;'>";
    }
    elseif($row['stat']=="网站打开异常"){
      echo "<tr style='color:red;'>";
    }
    else{echo "<tr style=''>";}
  
  echo "<td>" . $row['gov'] . "</td>";
  echo "<td><a href='http://".$row['host']."'  target='_blank'>" . $row['host'] . "</td>";
  echo "<td>" . $row['stat'] . "</td>";

  echo "<td>" . $row['mon'] . "</td>";
  printf('<td style=" text-align:center">
    <input name="host[]" type="checkbox" value="%s" />选中</td>

     ',$row['host']);

  echo "</tr>";
  }
echo "</table>";

mysql_close($con);

echo '</form>'
?> 
</div>